# Contributor: Cian Hughes <Ci@nHugh.es>
# Maintainer: Cian Hughes <Ci@nHugh.es>
pkgname=lirc
pkgver=0.10.1
pkgrel=3
pkgdesc="Infrared signal receiver and sender"
options="!check" # no tests
arch="all"
url="https://lirc.org"
license="GPL-2.0-only"
makedepends="
	linux-headers
	bash
	python3
	py3-yaml
	py3-setuptools
	libtool
	autoconf
	automake
	libxslt
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-python:python:noarch"
source="https://master.dl.sourceforge.net/project/lirc/LIRC/$pkgver/lirc-$pkgver.tar.gz
	0001-lirc.org-Remove-non-free-advertising.patch
	0002-lirc-setup-Fix-crash-on-start-on-missing-lirc.config.patch
	0003-logging-Don-t-use-broken-LOG_CONS-syslog-flag.patch
	0004-lircd-Fix-connect-option-parsing-error-343.patch
	0006-lirc-gpio-ir-0.10.patch
	0007-dont-build-python-module.patch
	0008-fix-event-time-on-32bit.patch
	new-py3-yaml.patch
	"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--prefix=/usr \
		--localstatedir=/var \
		--enable-devinput \
		--enable-uinput
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

python() {
	pkgdesc="Python3 bindings for lirc"
	depends=""

	amove usr/lib/python3*

	# This is a symlink to ../lib/python3.10/site-packages/lirc-setup/lirc-setup
	# if we don't move this symlink to the subpackage we have a recursive dep.
	amove usr/bin/lirc-setup
}

sha512sums="
33d9bd55bccf726ea39625f124d429cd13b64a8427b890a6210752c6307727439b25a04f00d8d26aee84003ed9e2eeb259da81a7d26913f1aa7210fd1fa26a55  lirc-0.10.1.tar.gz
12ad8a6ad5d600ac9ebe65e3eb8d05b77745b1e8c4cc51924d8135994b9e0419765f3a16d692eeca5c1c525672be69975e6145be714b5b05a6f8b61677d3fbbf  0001-lirc.org-Remove-non-free-advertising.patch
9379c9c43fea67f67de59b64596e1c6937656bff74f9b5c4fe5de407eeeaf02552ea50fcbd85656899f268dc9b6c1d5de944b928bb8db303032442409dc5c2f4  0002-lirc-setup-Fix-crash-on-start-on-missing-lirc.config.patch
a5a328269cb0d72f0d495da92c1726b18fce9549395ccaaa3d8697ed9d12e7025186d4f2a01dce2c58eda05e1d86934eef80700c51de79342d33f51e579031af  0003-logging-Don-t-use-broken-LOG_CONS-syslog-flag.patch
255ecae987ea0225b9d1d4d277b54a1c7103c7f7d2c9742e2197972381d8823353816674f888779bdf53b538f2bc8f9525452469fb73453299a3006aec7ceb93  0004-lircd-Fix-connect-option-parsing-error-343.patch
387fbf736473ce225737ba2937ded89d4b10953ce4e072a120397c949e7e7b43389855bc4e18cfb960069df3ed10fdc20314893019bdad464bae9557e47b0227  0006-lirc-gpio-ir-0.10.patch
3a018cacfb1a1f0c0c288cb3916d235569337d57e93c5b78a17e7cdf08e13ab4e1fce40e4e9ece647ea94dcc175d48a6bdd8fcf60a08891fbf0737ef4224b93b  0007-dont-build-python-module.patch
7e8d5e32d05b3cede9d4a0ab9e6873ef69f49dd325c6dc1522c72fb8aeb05bd370b4588723321346808e52b48e8422b8eb67930baeb28e0d58dbe18449dabfc7  0008-fix-event-time-on-32bit.patch
309f372cf134ac40252264b2618e05ccd794a611494b2d774121a1626fca7d0831b61ec2ee9938da716ef26a0fb84fff4062e8fda718f85d7629bac5769bdf3b  new-py3-yaml.patch
"
